package edu.fanhuiling.blogsystem.service;

import edu.fanhuiling.blogsystem.mapper.BlogInfoMapper;
import edu.fanhuiling.blogsystem.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    private BlogInfoMapper blogInfoMapper;
// 博客列表
    public List<BlogInfo> getList() {
        return blogInfoMapper.getBlogList();
    }
// 博客详情
    public BlogInfo getDetailById(Integer blogId) {
        return blogInfoMapper.getDetailById(blogId);
    }
// 发布博客------添加博客
    public Integer insertBlog(BlogInfo blogInfo) {
        return blogInfoMapper.addBlog(blogInfo);
    }
//   编辑博客
    public Integer updateBlog(BlogInfo blogInfo) {
        return  blogInfoMapper.editBlog(blogInfo);
    }
//  删除博客
    public Integer deleteBlog(Integer blogId) {
        return blogInfoMapper.deleteBlog(blogId);
    }
}
